import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-08-17
 * Time: 17:43
 */
public class Test {
    public static void insertSort(int[] arr) {
        for (int i = 1; i < arr.length; i++) {
            int tmp = arr[i];
            int j = i-1;
            for ( ; j >= 0; j--) {
                if (tmp < arr[j]) {
                    arr[j + 1] = arr[j];
                }else {
                    break;
                }
            }
            arr[j+1] = tmp;
        }
    }
    public static void main(String[] args) {
        int[] arr = {23,122,0,12,5657,12,-14,2,7,2,19,24,26,10,88,66,16};
        insertSort(arr);
        System.out.println(Arrays.toString(arr));
    }
}
